package model.searchers;

import java.io.IOException;
import model.searchers.linkedListSearcher.LinkedList;

/**
 * The interface ISearcher is implemented by searcher classes through which all communication
 * with the model passes. Thus, this list of methods determines the possibilities of
 * interfacing with the model.
 */
public interface ISearcher {

	/**
	 * Put a new word into the data structure
	 * 
	 * @param key	word to add
	 */
	public void put(String key);

	/**
	 * Put a new pair of a search word and the URL on which it occurs into the data structure
	 * 
	 * @param key	search word to add
	 * @param value	corresponding URL
	 */
	public void put(String key, String value);

	/**
	 * Find the URLs on which the specified word occurs
	 * 
	 * @param key search word
	 */
	public LinkedList get(String key);

	/**
	 * Find the URLs on which the specified word occurs
	 * 
	 * @param key search word
	 */
	public String[] getFormattedResult(String key);

	/**
	 * Create a sample of specified size containing (pseudo)random search words from the nested linked list.
	 * To be used for benchmarking
	 * 
	 * @param sampleSize	size of sample
	 * @return	array of search words
	 */
	public String[] createSample(int sampleSize);
	
	/**
	 * wraps and times the loading of data in a file
	 * 
	 * @param fileName name of the file to load
	 * @return duration of the load
	 * @throws IOException if problems reading the file
	 */
	public long loadData(String fileName) throws IOException;
	
	/**
	 * Returns whether or not the searcher accounts for boolean operators
	 * 
	 * @return whether or not the searcher accounts for boolean operators
	 */
	public boolean isBooleanSearch();
	
	/**
	 * Returns a string with information about the searcher such as the name of the file
	 * loaded, type of searcher, whether or not it sorts the results and whether or not
	 * it accounts for boolean operators
	 * 
	 * @return string of information about the searcher
	 */
	public String toString();
	
	public String getFileName();


}
